<?php

class articlesController {
	
	function __construct() {
	}
	
	public function render( $tplname ) {
		$block = App::me()->viewPath. DIRECTORY_SEPARATOR .'articles'. DIRECTORY_SEPARATOR .$tplname;
		$tpl = App::me()->tpl;
		$tpl->display($block.'.tpl');
	}
	
	public function index() {		
		if( !Tools::isAjax() ) return;
		$this->render('form');		
	}	

	public function listart() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->listart();
		echo json_encode( $data );
	}
	
	public function find() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->find();
		echo json_encode( $data );
	}
	
	public function insart() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->insart();
		echo json_encode( $data );
	}
	
	public function updart() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->updart();
		echo json_encode( $data );
	}
	
	public function delart() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->delart();
		echo json_encode( $data );
	}
	
	public function listuni() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->listuni();
		echo json_encode( $data );
	}
	
	public function insuni() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->insuni();
		echo json_encode( $data );
	}
	
	public function upduni() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->upduni();
		echo json_encode( $data );
	}
	
	public function deluni() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->deluni();
		echo json_encode( $data );
	}
	
	public function copyuni() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new articles;
		$data = $model->copyuni();
		echo json_encode( $data );
	}
	
	public function jsload() {		
		if( !Tools::isAjax() ) return;
		App::me()->js_load('articles.js');
	}	
	
}
?>